'use strict';
const db = uniCloud.database()
const {
  Base64
} = require("base64")
exports.main = async (event, context) => {
  //event为客户端上传的参数
  console.log('event : ', event)
  let base = new Base64()
  // 先获取用户信息
  const res = await db.collection("users").where({
    openid: JSON.parse(base.decode(event.openid))
  }).get()
  //返回数据给客户端
  return res
};
